<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: ActiveRecord::ConnectionAdapters::Column</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">ActiveRecord::ConnectionAdapters::Column</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions_rb.html">
                vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
An abstract definition of a column in a table.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M001206">binary_to_string</a>&nbsp;&nbsp;
      <a href="#M001204">extract_default</a>&nbsp;&nbsp;
      <a href="#M001217">fallback_string_to_date</a>&nbsp;&nbsp;
      <a href="#M001218">fallback_string_to_time</a>&nbsp;&nbsp;
      <a href="#M001215">fast_string_to_date</a>&nbsp;&nbsp;
      <a href="#M001216">fast_string_to_time</a>&nbsp;&nbsp;
      <a href="#M001203">human_name</a>&nbsp;&nbsp;
      <a href="#M001200">klass</a>&nbsp;&nbsp;
      <a href="#M001212">microseconds</a>&nbsp;&nbsp;
      <a href="#M001197">new</a>&nbsp;&nbsp;
      <a href="#M001213">new_date</a>&nbsp;&nbsp;
      <a href="#M001214">new_time</a>&nbsp;&nbsp;
      <a href="#M001199">number?</a>&nbsp;&nbsp;
      <a href="#M001205">string_to_binary</a>&nbsp;&nbsp;
      <a href="#M001207">string_to_date</a>&nbsp;&nbsp;
      <a href="#M001209">string_to_dummy_time</a>&nbsp;&nbsp;
      <a href="#M001208">string_to_time</a>&nbsp;&nbsp;
      <a href="#M001198">text?</a>&nbsp;&nbsp;
      <a href="#M001201">type_cast</a>&nbsp;&nbsp;
      <a href="#M001202">type_cast_code</a>&nbsp;&nbsp;
      <a href="#M001210">value_to_boolean</a>&nbsp;&nbsp;
      <a href="#M001211">value_to_decimal</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">

    <div id="class-list">
      <h3 class="section-bar">Classes and Modules</h3>

      Module <a href="Column/Format.html" class="link">ActiveRecord::ConnectionAdapters::Column::Format</a><br />

    </div>




    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">default</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">limit</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">name</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">null</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">precision</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">primary</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">scale</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">sql_type</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">type</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M001206" class="method-detail">
        <a name="M001206"></a>

        <div class="method-heading">
          <a href="#M001206" class="method-signature">
          <span class="method-name">binary_to_string</span><span class="method-args">(value)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Used to convert from BLOBs to Strings
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001206-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001206-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 111</span>
111:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">binary_to_string</span>(<span class="ruby-identifier">value</span>)
112:           <span class="ruby-identifier">value</span>
113:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001197" class="method-detail">
        <a name="M001197"></a>

        <div class="method-heading">
          <a href="#M001197" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(name, default, sql_type = nil, null = true)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Instantiates a <a href="Column.html#M001197">new</a> column in the table.
</p>
<p>
<tt>name</tt> is the column&#8216;s name, as in <b><tt>supplier_id</b>
int(11)</tt>. <tt>default</tt> is the type-casted default value, such as
<tt>sales_stage varchar(20) default <b>&#8216;<a
href="Column.html#M001197">new</a>&#8216;</tt></b>. <tt>sql_type</tt> is
only used to extract the column&#8216;s length, if necessary. For example,
<tt>company_name varchar(<b>60</b>)</tt>. <tt>null</tt> determines if this
column allows <tt>NULL</tt> values.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001197-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001197-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 23</span>
23:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">default</span>, <span class="ruby-identifier">sql_type</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">null</span> = <span class="ruby-keyword kw">true</span>)
24:         <span class="ruby-ivar">@name</span>, <span class="ruby-ivar">@sql_type</span>, <span class="ruby-ivar">@null</span> = <span class="ruby-identifier">name</span>, <span class="ruby-identifier">sql_type</span>, <span class="ruby-identifier">null</span>
25:         <span class="ruby-ivar">@limit</span>, <span class="ruby-ivar">@precision</span>, <span class="ruby-ivar">@scale</span>  = <span class="ruby-identifier">extract_limit</span>(<span class="ruby-identifier">sql_type</span>), <span class="ruby-identifier">extract_precision</span>(<span class="ruby-identifier">sql_type</span>), <span class="ruby-identifier">extract_scale</span>(<span class="ruby-identifier">sql_type</span>) 
26:         <span class="ruby-ivar">@type</span> = <span class="ruby-identifier">simplified_type</span>(<span class="ruby-identifier">sql_type</span>)
27:         <span class="ruby-ivar">@default</span> = <span class="ruby-identifier">extract_default</span>(<span class="ruby-identifier">default</span>)
28: 
29:         <span class="ruby-ivar">@primary</span> = <span class="ruby-keyword kw">nil</span>
30:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001205" class="method-detail">
        <a name="M001205"></a>

        <div class="method-heading">
          <a href="#M001205" class="method-signature">
          <span class="method-name">string_to_binary</span><span class="method-args">(value)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Used to convert from Strings to BLOBs
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001205-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001205-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 106</span>
106:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">string_to_binary</span>(<span class="ruby-identifier">value</span>)
107:           <span class="ruby-identifier">value</span>
108:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001207" class="method-detail">
        <a name="M001207"></a>

        <div class="method-heading">
          <a href="#M001207" class="method-signature">
          <span class="method-name">string_to_date</span><span class="method-args">(string)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001207-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001207-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 115</span>
115:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">string_to_date</span>(<span class="ruby-identifier">string</span>)
116:           <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">string</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
117:           <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">empty?</span>
118: 
119:           <span class="ruby-identifier">fast_string_to_date</span>(<span class="ruby-identifier">string</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">fallback_string_to_date</span>(<span class="ruby-identifier">string</span>)
120:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001209" class="method-detail">
        <a name="M001209"></a>

        <div class="method-heading">
          <a href="#M001209" class="method-signature">
          <span class="method-name">string_to_dummy_time</span><span class="method-args">(string)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001209-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001209-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 129</span>
129:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">string_to_dummy_time</span>(<span class="ruby-identifier">string</span>)
130:           <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">string</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
131:           <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">empty?</span>
132: 
133:           <span class="ruby-identifier">string_to_time</span> <span class="ruby-node">&quot;2000-01-01 #{string}&quot;</span>
134:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001208" class="method-detail">
        <a name="M001208"></a>

        <div class="method-heading">
          <a href="#M001208" class="method-signature">
          <span class="method-name">string_to_time</span><span class="method-args">(string)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001208-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001208-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 122</span>
122:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">string_to_time</span>(<span class="ruby-identifier">string</span>)
123:           <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">string</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
124:           <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">empty?</span>
125: 
126:           <span class="ruby-identifier">fast_string_to_time</span>(<span class="ruby-identifier">string</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">fallback_string_to_time</span>(<span class="ruby-identifier">string</span>)
127:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001210" class="method-detail">
        <a name="M001210"></a>

        <div class="method-heading">
          <a href="#M001210" class="method-signature">
          <span class="method-name">value_to_boolean</span><span class="method-args">(value)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
convert something to a boolean
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001210-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001210-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 137</span>
137:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">value_to_boolean</span>(<span class="ruby-identifier">value</span>)
138:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span>
139:             <span class="ruby-identifier">value</span>
140:           <span class="ruby-keyword kw">else</span>
141:             <span class="ruby-node">%w(true t 1)</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span>)
142:           <span class="ruby-keyword kw">end</span>
143:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001211" class="method-detail">
        <a name="M001211"></a>

        <div class="method-heading">
          <a href="#M001211" class="method-signature">
          <span class="method-name">value_to_decimal</span><span class="method-args">(value)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
convert something to a BigDecimal
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001211-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001211-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 146</span>
146:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">value_to_decimal</span>(<span class="ruby-identifier">value</span>)
147:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">BigDecimal</span>)
148:             <span class="ruby-identifier">value</span>
149:           <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_d</span>)
150:             <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_d</span>
151:           <span class="ruby-keyword kw">else</span>
152:             <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_d</span>
153:           <span class="ruby-keyword kw">end</span>
154:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Protected Class methods</h3>

      <div id="method-M001217" class="method-detail">
        <a name="M001217"></a>

        <div class="method-heading">
          <a href="#M001217" class="method-signature">
          <span class="method-name">fallback_string_to_date</span><span class="method-args">(string)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001217-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001217-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 194</span>
194:           <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fallback_string_to_date</span>(<span class="ruby-identifier">string</span>)
195:             <span class="ruby-identifier">new_date</span> <span class="ruby-operator">*</span><span class="ruby-constant">ParseDate</span>.<span class="ruby-identifier">parsedate</span>(<span class="ruby-identifier">string</span>)[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">2</span>]
196:           <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001218" class="method-detail">
        <a name="M001218"></a>

        <div class="method-heading">
          <a href="#M001218" class="method-signature">
          <span class="method-name">fallback_string_to_time</span><span class="method-args">(string)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001218-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001218-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 198</span>
198:           <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fallback_string_to_time</span>(<span class="ruby-identifier">string</span>)
199:             <span class="ruby-identifier">time_hash</span> = <span class="ruby-constant">Date</span>.<span class="ruby-identifier">_parse</span>(<span class="ruby-identifier">string</span>)
200:             <span class="ruby-identifier">time_hash</span>[<span class="ruby-identifier">:sec_fraction</span>] = <span class="ruby-identifier">microseconds</span>(<span class="ruby-identifier">time_hash</span>)
201: 
202:             <span class="ruby-identifier">new_time</span> <span class="ruby-operator">*</span><span class="ruby-identifier">time_hash</span>.<span class="ruby-identifier">values_at</span>(<span class="ruby-identifier">:year</span>, <span class="ruby-identifier">:mon</span>, <span class="ruby-identifier">:mday</span>, <span class="ruby-identifier">:hour</span>, <span class="ruby-identifier">:min</span>, <span class="ruby-identifier">:sec</span>, <span class="ruby-identifier">:sec_fraction</span>)
203:           <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001215" class="method-detail">
        <a name="M001215"></a>

        <div class="method-heading">
          <a href="#M001215" class="method-signature">
          <span class="method-name">fast_string_to_date</span><span class="method-args">(string)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001215-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001215-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 180</span>
180:           <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fast_string_to_date</span>(<span class="ruby-identifier">string</span>)
181:             <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">Format</span><span class="ruby-operator">::</span><span class="ruby-constant">ISO_DATE</span>
182:               <span class="ruby-identifier">new_date</span> <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span>
183:             <span class="ruby-keyword kw">end</span>
184:           <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001216" class="method-detail">
        <a name="M001216"></a>

        <div class="method-heading">
          <a href="#M001216" class="method-signature">
          <span class="method-name">fast_string_to_time</span><span class="method-args">(string)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Doesn&#8216;t handle time zones.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001216-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001216-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 187</span>
187:           <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fast_string_to_time</span>(<span class="ruby-identifier">string</span>)
188:             <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">Format</span><span class="ruby-operator">::</span><span class="ruby-constant">ISO_DATETIME</span>
189:               <span class="ruby-identifier">microsec</span> = (<span class="ruby-identifier">$7</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">*</span> <span class="ruby-value">1_000_000</span>).<span class="ruby-identifier">to_i</span>
190:               <span class="ruby-identifier">new_time</span> <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$4</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$5</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$6</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">microsec</span>
191:             <span class="ruby-keyword kw">end</span>
192:           <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001212" class="method-detail">
        <a name="M001212"></a>

        <div class="method-heading">
          <a href="#M001212" class="method-signature">
          <span class="method-name">microseconds</span><span class="method-args">(time)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
&#8216;0.123456&#8217; -&gt; 123456 &#8216;1.123456&#8217; -&gt; 123456
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001212-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001212-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 159</span>
159:           <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">microseconds</span>(<span class="ruby-identifier">time</span>)
160:             ((<span class="ruby-identifier">time</span>[<span class="ruby-identifier">:sec_fraction</span>].<span class="ruby-identifier">to_f</span> <span class="ruby-operator">%</span> <span class="ruby-value">1</span>) <span class="ruby-operator">*</span> <span class="ruby-value">1_000_000</span>).<span class="ruby-identifier">to_i</span>
161:           <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001213" class="method-detail">
        <a name="M001213"></a>

        <div class="method-heading">
          <a href="#M001213" class="method-signature">
          <span class="method-name">new_date</span><span class="method-args">(year, mon, mday)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001213-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001213-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 163</span>
163:           <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_date</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">mday</span>)
164:             <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
165:               <span class="ruby-constant">Date</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">mday</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
166:             <span class="ruby-keyword kw">end</span>
167:           <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001214" class="method-detail">
        <a name="M001214"></a>

        <div class="method-heading">
          <a href="#M001214" class="method-signature">
          <span class="method-name">new_time</span><span class="method-args">(year, mon, mday, hour, min, sec, microsec)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001214-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001214-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 169</span>
169:           <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_time</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">mday</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">microsec</span>)
170:             <span class="ruby-comment cmt"># Treat 0000-00-00 00:00:00 as nil.</span>
171:             <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">year</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
172: 
173:             <span class="ruby-constant">Time</span>.<span class="ruby-identifier">send</span>(<span class="ruby-constant">Base</span>.<span class="ruby-identifier">default_timezone</span>, <span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">mday</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">microsec</span>)
174:           <span class="ruby-comment cmt"># Over/underflow to DateTime</span>
175:           <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-constant">TypeError</span>
176:             <span class="ruby-identifier">zone_offset</span> = <span class="ruby-constant">Base</span>.<span class="ruby-identifier">default_timezone</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:local</span> <span class="ruby-operator">?</span> <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">local_offset</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
177:             <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">mday</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">zone_offset</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
178:           <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M001204" class="method-detail">
        <a name="M001204"></a>

        <div class="method-heading">
          <a href="#M001204" class="method-signature">
          <span class="method-name">extract_default</span><span class="method-args">(default)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001204-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001204-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 100</span>
100:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">extract_default</span>(<span class="ruby-identifier">default</span>)
101:         <span class="ruby-identifier">type_cast</span>(<span class="ruby-identifier">default</span>)
102:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001203" class="method-detail">
        <a name="M001203"></a>

        <div class="method-heading">
          <a href="#M001203" class="method-signature">
          <span class="method-name">human_name</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the human name of the column name.
</p>
<h5>Examples</h5>
<pre>
 Column.new('sales_stage', ...).human_name #=&gt; 'Sales stage'
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001203-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001203-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 96</span>
96:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">human_name</span>
97:         <span class="ruby-constant">Base</span>.<span class="ruby-identifier">human_attribute_name</span>(<span class="ruby-ivar">@name</span>)
98:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001200" class="method-detail">
        <a name="M001200"></a>

        <div class="method-heading">
          <a href="#M001200" class="method-signature">
          <span class="method-name">klass</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the Ruby class that corresponds to the abstract data type.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001200-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001200-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 41</span>
41:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">klass</span>
42:         <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>
43:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:integer</span>       <span class="ruby-keyword kw">then</span> <span class="ruby-constant">Fixnum</span>
44:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:float</span>         <span class="ruby-keyword kw">then</span> <span class="ruby-constant">Float</span>
45:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:decimal</span>       <span class="ruby-keyword kw">then</span> <span class="ruby-constant">BigDecimal</span>
46:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:datetime</span>      <span class="ruby-keyword kw">then</span> <span class="ruby-constant">Time</span>
47:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:date</span>          <span class="ruby-keyword kw">then</span> <span class="ruby-constant">Date</span>
48:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:timestamp</span>     <span class="ruby-keyword kw">then</span> <span class="ruby-constant">Time</span>
49:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:time</span>          <span class="ruby-keyword kw">then</span> <span class="ruby-constant">Time</span>
50:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:text</span>, <span class="ruby-identifier">:string</span> <span class="ruby-keyword kw">then</span> <span class="ruby-constant">String</span>
51:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:binary</span>        <span class="ruby-keyword kw">then</span> <span class="ruby-constant">String</span>
52:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:boolean</span>       <span class="ruby-keyword kw">then</span> <span class="ruby-constant">Object</span>
53:         <span class="ruby-keyword kw">end</span>
54:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001199" class="method-detail">
        <a name="M001199"></a>

        <div class="method-heading">
          <a href="#M001199" class="method-signature">
          <span class="method-name">number?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001199-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001199-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 36</span>
36:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">number?</span>
37:         [<span class="ruby-identifier">:float</span>, <span class="ruby-identifier">:integer</span>, <span class="ruby-identifier">:decimal</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">type</span>
38:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001198" class="method-detail">
        <a name="M001198"></a>

        <div class="method-heading">
          <a href="#M001198" class="method-signature">
          <span class="method-name">text?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001198-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001198-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 32</span>
32:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">text?</span>
33:         [<span class="ruby-identifier">:string</span>, <span class="ruby-identifier">:text</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">type</span>
34:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001201" class="method-detail">
        <a name="M001201"></a>

        <div class="method-heading">
          <a href="#M001201" class="method-signature">
          <span class="method-name">type_cast</span><span class="method-args">(value)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Casts value (which is a String) to an appropriate instance.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001201-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001201-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 57</span>
57:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type_cast</span>(<span class="ruby-identifier">value</span>)
58:         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>
59:         <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>
60:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:string</span>    <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">value</span>
61:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:text</span>      <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">value</span>
62:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:integer</span>   <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
63:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:float</span>     <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_f</span>
64:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:decimal</span>   <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">value_to_decimal</span>(<span class="ruby-identifier">value</span>)
65:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:datetime</span>  <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">string_to_time</span>(<span class="ruby-identifier">value</span>)
66:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:timestamp</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">string_to_time</span>(<span class="ruby-identifier">value</span>)
67:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:time</span>      <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">string_to_dummy_time</span>(<span class="ruby-identifier">value</span>)
68:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:date</span>      <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">string_to_date</span>(<span class="ruby-identifier">value</span>)
69:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:binary</span>    <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">binary_to_string</span>(<span class="ruby-identifier">value</span>)
70:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:boolean</span>   <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">value_to_boolean</span>(<span class="ruby-identifier">value</span>)
71:           <span class="ruby-keyword kw">else</span> <span class="ruby-identifier">value</span>
72:         <span class="ruby-keyword kw">end</span>
73:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001202" class="method-detail">
        <a name="M001202"></a>

        <div class="method-heading">
          <a href="#M001202" class="method-signature">
          <span class="method-name">type_cast_code</span><span class="method-args">(var_name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001202-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001202-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 75</span>
75:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type_cast_code</span>(<span class="ruby-identifier">var_name</span>)
76:         <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>
77:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:string</span>    <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">nil</span>
78:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:text</span>      <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">nil</span>
79:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:integer</span>   <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;(#{var_name}.to_i rescue #{var_name} ? 1 : 0)&quot;</span>
80:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:float</span>     <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{var_name}.to_f&quot;</span>
81:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:decimal</span>   <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{self.class.name}.value_to_decimal(#{var_name})&quot;</span>
82:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:datetime</span>  <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{self.class.name}.string_to_time(#{var_name})&quot;</span>
83:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:timestamp</span> <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{self.class.name}.string_to_time(#{var_name})&quot;</span>
84:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:time</span>      <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{self.class.name}.string_to_dummy_time(#{var_name})&quot;</span>
85:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:date</span>      <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{self.class.name}.string_to_date(#{var_name})&quot;</span>
86:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:binary</span>    <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{self.class.name}.binary_to_string(#{var_name})&quot;</span>
87:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:boolean</span>   <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{self.class.name}.value_to_boolean(#{var_name})&quot;</span>
88:           <span class="ruby-keyword kw">else</span> <span class="ruby-keyword kw">nil</span>
89:         <span class="ruby-keyword kw">end</span>
90:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>